package wj.d828;

import java.util.Scanner;

public class GradeLevel {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int score = scanner.nextInt();
        String[] numStrArray = str.trim().split(" ");
        int[] scores = new int[numStrArray.length];
        for (int i = 0; i < numStrArray.length; i++) {
            scores[i] = Short.valueOf(numStrArray[i]);
        }
        //排序
        // 二分查找
        int order = binarySearch(scores, score);
        String result = "";
        if (order < 5) {
            result = "A+";
        } else if (order < 15) {
            result = "A0";
        } else if (order < 30) {
            result = "B+";
        } else if (order < 35) {
            result = "B0";
        } else if (order < 45) {
            result = "C+";
        } else if (order < 48) {
            result = "C0";
        } else {
            result = "F";
        }
        System.out.println(result);
    }

    private static int binarySearch(int[] nums, int num) {
        int left = 0, right = nums.length - 1;
        while (left < right) {
            int mid = (left + right) / 2;
            if (nums[mid] == num) {
                return mid;
            } else if (nums[mid] < num) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }

        return -1;
    }
}
